<html>
<head><meta charset="utf-8"><title>mio and libc::sockaddr · wg-secure-code · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/index.html">wg-secure-code</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/mio.20and.20libc.3A.3Asockaddr.html">mio and libc::sockaddr</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="215345467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/mio%20and%20libc%3A%3Asockaddr/near/215345467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/mio.20and.20libc.3A.3Asockaddr.html#215345467">(Nov 02 2020 at 16:48)</a>:</h4>
<p>This seems less-than-ideal: <a href="https://internals.rust-lang.org/t/why-are-socketaddrv4-socketaddrv6-based-on-low-level-sockaddr-in-6/13321">https://internals.rust-lang.org/t/why-are-socketaddrv4-socketaddrv6-based-on-low-level-sockaddr-in-6/13321</a></p>
<blockquote>
<p>But I was a bit shocked to find that mio (and by extension tokio) relies on these structs indeed being implemented directly as libc::sockaddr: <a href="https://github.com/tokio-rs/mio/blob/27fbd5f04bb5f52a4d1c358cf0c04c6074a3d46b/src/sys/unix/net.rs#L78-L85">https://github.com/tokio-rs/mio/blob/27fbd5f04bb5f52a4d1c358cf0c04c6074a3d46b/src/sys/unix/net.rs#L78-L85</a> 4. I don't find this specified in the documentation for std::net::SocketAddrV4/6. Does mio invalidly rely on this representation, or have I missed where this contract was set up between std and the rest of the world?</p>
</blockquote>



<a name="215759160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/mio%20and%20libc%3A%3Asockaddr/near/215759160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Shnatsel <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/mio.20and.20libc.3A.3Asockaddr.html#215759160">(Nov 05 2020 at 19:04)</a>:</h4>
<p>This is more worrying: <a href="https://github.com/tokio-rs/tokio/issues/3101">https://github.com/tokio-rs/tokio/issues/3101</a></p>



<a name="215760446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/mio%20and%20libc%3A%3Asockaddr/near/215760446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tony Arcieri <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/mio.20and.20libc.3A.3Asockaddr.html#215760446">(Nov 05 2020 at 19:14)</a>:</h4>
<p>oof</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>